package jgl.vajra.driver.part.mine.activity;

import jgl.vajra.driver.R;
import jgl.vajra.driver.databinding.ActivityAccountPageBinding;
import jgl.vajra.driver.listener.MessageDlialogListener;
import jgl.vajra.driver.manager.FragmentManager;
import jgl.vajra.driver.manager.IntentManager;
import jgl.vajra.driver.part.mine.contract.AccountPageContract;
import jgl.vajra.driver.part.mine.viewModel.AccountPageViewModel;
import jgl.vajra.driver.widget.dialogfragment.MessageDialogFragment;
import jgl.vajra.driver.widget.mvvm.factory.CreateViewModel;
import jgl.vajra.driver.widget.mvvm.view.BaseMVVMActivity;
import jgl.vajra.driver.widget.utils.ToastUtils;

@CreateViewModel(AccountPageViewModel.class)
public class AccountPageActivity extends BaseMVVMActivity<AccountPageViewModel, ActivityAccountPageBinding> implements AccountPageContract.View {

    private MessageDialogFragment messageDialogCancelAccount;

    @Override
    public int getLayoutId() {
        return R.layout.activity_account_page;
    }

    @Override
    public void initView() {
        super.initView();
        mBinding.setView(this);
    }

    //更换手机号
    @Override
    public void onChangePhone() {
        IntentManager.toChangePhoneActivity(this);
    }

    //注销账号
    @Override
    public void onCancelAccount() {
        if (messageDialogCancelAccount == null) {
            messageDialogCancelAccount = FragmentManager.getMessageDialogCancelAccount(new MessageDlialogListener() {
                @Override
                public void onRightClick() {
                    ToastUtils.showShort("确定注销");
                }

                @Override
                public void onLeftClick() {
                    ToastUtils.showShort("我再想想");
                }
            });
        }
        messageDialogCancelAccount.show(getSupportFragmentManager());
    }
}
